package reflect;

import reflect.anno.AutoRunClass;

import java.io.File;
import java.net.URISyntaxException;

public class Test4 {
    public static void main(String[] args) throws URISyntaxException, ClassNotFoundException{
        File dir = new File(
                Test3.class.getResource(".").toURI()
        );
        String packname = Test4.class.getPackage().getName();
        File[] files = dir.listFiles(f -> f.getName().endsWith(".class"));
        for (File file : files) {
            String substring = file.getName().substring(0, file.getName().indexOf("."));
            Class<?> aClass = Class.forName(packname + "." + substring);
            if (aClass.isAnnotationPresent(AutoRunClass.class)) {
                System.out.println(file.getName());
            }


        }

    }}